<?php
/**
 * User: itimphp
 * Date: 6/5/12
 * Time: 7:05 PM
 */
require_once 'bootstrap.php';
$multichoice = Service_Value::get_multilchoice(1);
?>

<head xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
	<link href="css/bootstrap.css" type="text/css" rel="stylesheet">
	<link href="css/bootstrap-responsive.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.js"></script>
	<script type="text/javascript" src="js/bootstrap.datetimepicker.js"></script>
	<title>Loan form - Form 1</title>
</head>
<html>
<body style="background-color:#000;">
<script type="text/javascript">
	var RecaptchaOptions = {
		theme:'white'
	};
</script>
<div style="background-color:#E9E9E9; width: 700px; margin-left: auto; margin-right: auto;">
<form class="form-inline form-horizontal" method="POST" action="form1.php" onsubmit="return validate();"
      id="form1">
<fieldset class="control-group">
	<legend>Personal information</legend>
	<div class="control-group">
		<label class="control-label" for="requested_amount">Request Amount</label>

		<div class="controls">
			<select name="requested_amount" id="requested_amount" class="require">
				<option value="">I need...</option>
				<?php foreach ($multichoice['requested_amount'] as $key => $value): ?>
				<option value="<?= $key ?>"><?= $value ?></option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="email">Email</label>

		<div class="controls">
			<input type="text" id="email" name="email" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="title">Title</label>

		<div class="controls">
			<select name="title" id="title" class="require">
				<option value="">Select One...</option>
				<?php foreach ($multichoice['title'] as $key => $value): ?>
				<option value="<?= $key ?>"><?= $value ?></option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="first_name">First name</label>

		<div class="controls">
			<input type="text" id="first_name" name="first_name" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="last_name">Last name</label>

		<div class="controls">
			<input type="text" id="last_name" name="last_name" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="postcode">Postal code</label>

		<div class="controls">
			<input type="text" id="postcode" name="postcode" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="streetnumber">House name/number</label>

		<div class="controls">
			<input type="text" id="streetnumber" name="streetnumber" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="streetname">Street name</label>

		<div class="controls">
			<input type="text" id="streetname" name="streetname" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="town">Town</label>

		<div class="controls">
			<input type="text" id="town" name="town" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="country">Country</label>

		<div class="controls">
			<select name="country" id="country" class="require">
				<option value="">Country?</option>
				<?php foreach ($multichoice['country'] as $key => $value): ?>
				<option value="<?= $key ?>"><?= $value ?></option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="own_home">Rent or Own?</label>

		<div class="controls">
			<select name="own_home" id="own_home" class="require">
				<option value="">Select One...</option>
				<?php foreach ($multichoice['own_home'] as $key => $value): ?>
				<option value="<?= $key ?>"><?= $value ?></option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="home_phone">Home phone</label>

		<div class="controls">
			<input type="text" id="home_phone" name="home_phone" class="span3">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="work_phone">Work phone</label>

		<div class="controls">
			<input type="text" id="work_phone" name="work_phone" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="mobile_phone">Mobile phone</label>

		<div class="controls">
			<input type="text" id="mobile_phone" name="mobile_phone" class="span3 require">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="address_length_year">Year at current home</label>

		<div class="controls">
			<select name="address_length_year" id="address_length_year" class="require">
				<option value="">Year...</option>
				<?php for ($i = 0; $i <= 20; $i++): ?>
				<option value="<?= $i ?>"><? echo $i; echo $i == 20 ? '+' : ''?></option>
				<?php endfor;?>
			</select>
			<select name="address_length_month" id="address_length_month" class="require">
				<option value="">Month...</option>
				<?php for ($i = 1; $i <= 11; $i++): ?>
				<option value="<?= $i ?>"><? echo $i;?></option>
				<?php endfor;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">Date of birth</label>

		<div class="controls">
			<select name="birth_date_day" id="birth_date_day" class="require">
				<option value="">Day...</option>
				<?php for ($i = 1; $i <= 31; $i++): ?>
				<option value="<?= $i ?>"><? echo $i;?></option>
				<?php endfor;?>
			</select>
			<select name="birth_date_month" id="birth_date_month" class="require">
				<option value="">Month...</option>
				<?php for ($i = 1; $i <= 12; $i++): ?>
				<option value="<?= $i ?>"><? echo $i;?></option>
				<?php endfor;?>
			</select>
			<select name="birth_date_year" id="birth_date_year" class="require">
				<option value="">Year...</option>
				<?php for ($i = 2012; $i > 1940; $i--): ?>
				<option value="<?= $i ?>"><? echo $i;?></option>
				<?php endfor;?>
			</select>
		</div>
	</div>
</fieldset>
<fieldset>
	<legend>Employment information</legend>
	<div class="control-group">
		<label class="control-label" for="income_type">Income source</label>

		<div class="controls">
			<select name="income_type" id="income_type" class="require">
				<option value="">Select one...</option>
				<?php foreach ($multichoice['income_type'] as $key => $value): ?>
				<option value="<?= $key ?>"><?= $value ?></option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="employer">Employer Name</label>

		<div class="controls">
			<input type="text" id="employer" name="employer" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="job_title">Job title</label>

		<div class="controls">
			<input type="text" id="job_title" name="job_title" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="income_type">Pay Frequency</label>

		<div class="controls">
			<select name="pay_frequency" id="pay_frequency" class="require">
				<option value="">Select one...</option>
				<?php foreach ($multichoice['pay_frequency'] as $key => $value): ?>
				<option value="<?= $key ?>"><?= $value ?></option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="next_pay_date">Next pay date</label>

		<div class="controls">
			<input type="text" id="next_pay_date" name="next_pay_date" class="span3 require"
			       data-datepicker="datepicker" maxlength="25">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="pay_date_after">Pay date after</label>

		<div class="controls">
			<input type="text" id="pay_date_after" name="pay_date_after" class="span3 require"
			       data-datepicker="datepicker" maxlength="25">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="employed_time_year">Time Employed</label>

		<div class="controls">
			<select name="employed_time_year" id="employed_time_year" class="require">
				<option value="">Year...</option>
				<?php for ($i = 0; $i <= 10; $i++): ?>
				<option value="<?= $i ?>"><? echo $i; echo $i == 10 ? '+' : ''?> Years</option>
				<?php endfor;?>
			</select>
			<select name="employed_time_month" id="employed_time_month" class="require">
				<option value="">Month...</option>
				<?php for ($i = 0; $i <= 11; $i++): ?>
				<option value="<?= $i ?>"><? echo $i;?> Months</option>
				<?php endfor;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="monthly_income">Monthly Income</label>

		<div class="controls">
			<select name="monthly_income" id="monthly_income" class="require">
				<option value="">Select one...</option>
				<?php for ($i = 5; $i <= 40; $i++): ?>
				<option value="<?= ($i * 100) ?>"><? echo $i * 100;?></option>
				<?php endfor;?>
				<option value="4000">More than 4,000</option>
			</select>
		</div>
	</div>
</fieldset>
<fieldset>
	<legend>Banking information</legend>
	<div class="control-group">
		<label class="control-label" for="bank_name">Bank name</label>

		<div class="controls">
			<input type="text" id="bank_name" name="bank_name" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="bank_account_number">Bank account number</label>

		<div class="controls">
			<input type="text" id="bank_account_number" name="bank_account_number" class="span3">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="bank_sort_code">Bank Sort Code</label>

		<div class="controls">
			<input type="text" id="bank_sort_code" name="bank_sort_code" class="span3 require" maxlength="255">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="debit_card">Debit card</label>

		<div class="controls">
			<select name="debit_card" id="debit_card" class="require">
				<option value="">Select one...</option>
				<?php foreach ($multichoice['debit_card'] as $key => $value): ?>
				<option value="<?= $key ?>"><?= $value ?></option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="direct_deposit">Direct deposit</label>

		<div class="controls">
			<select name="direct_deposit" id="direct_deposit" class="require">
				<option value="">Select one...</option>
				<option value="1">Yes</option>
				<option value="0">No</option>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="bank_account_length_months">Month of Bank</label>

		<div class="controls">
			<select name="bank_account_length_months" id="bank_account_length_months" class="require">
				<option value="">Select one...</option>
				<?php foreach ($multichoice['bank_account_length_months'] as $key => $value): ?>
				<option value="<?= $key ?>"><?= $value ?></option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
</fieldset>
<div class="control-group">
	<div class="controls">
		<label class="checkbox">
			<input type="checkbox" value="1" name="agr1" id="need">
			<span class="help-inline">I understand that lenders may use credit reference and fraud prevention agencies to make lending decisions and for the prevention of fraud and money laundering.</span>
		</label>
	</div>
</div>
<div class="control-group">
	<div class="controls">
		<label class="checkbox">
			<input type="checkbox" value="1" name="agr3">
			We would like to keep you informed by telephone, post or email of selected products and services available
			from us and our carefully chosen suppliers if you wish us to do so, please tick here.
		</label>
	</div>
</div>
<div class="control-group">
	<label class="control-label">Type the words</label>

	<div class="controls">
		<?php
		$publickey = '6LdkS9ISAAAAAAiOzrgYDSbCgcd9Fw4rutkulGQq'; // you got this from the signup page
		echo recaptcha_get_html($publickey);
		?>
	</div>
</div>
<div class="control-group">
	<div class="controls">
		<input type="submit" value="Submit">
	</div>
</div>
</form>
</div>
</body>
<script type="text/javascript">
	/* Update datepicker plugin so that MM/DD/YYYY format is used. */
	$.extend($.fn.datepicker.defaults, {
		parse:function (string) {
			var matches;
			//if ((matches = string.match(/^(\d{2,2})\/(\d{2,2})\/(\d{4,4})$/))) {
			if ((matches = string.match(/^(\d{4,4})-(\d{2,2})-(\d{2,2})$/))) {
				return new Date(matches[1], matches[2] - 1, matches[3]);
			} else {
				return null;
			}
		},
		format:function (date) {
			var
				month = (date.getMonth() + 1).toString(),
				dom = date.getDate().toString();
			if (month.length === 1) {
				month = "0" + month;
			}
			if (dom.length === 1) {
				dom = "0" + dom;
			}
			return date.getFullYear() + "-" + month + "-" + dom;
		}
	});
	function validate() {
		if (!$("#need").is(":checked")) {
			$("#need").parent().parent().parent().addClass("error");
			$("#need").focus();
			return false;
		} else {
			$("#need").parent().parent().parent().removeClass("error");
		}
		var ok = true;
		$(".require").each(function () {
			if ($(this).val() == "") {
				$(this).parent().parent().addClass("error");
				ok = false;
			} else {
				$(this).parent().parent().removeClass("error");
			}
		});
		if (!ok) {
			$(".alert-error").remove();
			$("#form1").prepend('<div class="alert alert-error">Please fill full information</div>');
		} else {
			$(".alert-error").remove();
		}
		return ok;
	}
</script>
</html>